//
//  UIScrollView+WSJRefresh_MJ.m
//  HandheldELearn
//
//  Created by wsj2015 on 16/7/16.
//  Copyright © 2016年 陈武琦. All rights reserved.
//

#import "UIScrollView+WSJRefresh_MJ.h"

@implementation UIScrollView (WSJRefresh_MJ)



-(void)wsj_HeaderRefreshBlock:(void(^)())block{
    
    MJRefreshGifHeader *header =[self addGifHeaderWithRefreshingBlock:block dateKey:nil];
    
    // 设置普通状态的动画图片
    NSMutableArray *idleImages = [NSMutableArray array];
    for (NSUInteger i = 1; i<=60; i++) {
        UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"dropdown_anim__000%zd", i]];
        [idleImages addObject:image];
    }
    [header setImages:idleImages forState:MJRefreshHeaderStateIdle];
    
    
    // 设置即将刷新状态的动画图片（一松开就会刷新的状态）
    NSMutableArray *refreshingImages = [NSMutableArray array];
    for (NSUInteger i = 1; i<=24; i++) {
        UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"dropdown_loading_0%zd", i]];
        [refreshingImages addObject:image];
    }
    [header setImages:refreshingImages forState: MJRefreshHeaderStatePulling];
    
    // 设置正在刷新状态的动画图片
    [header setImages:refreshingImages forState:MJRefreshHeaderStateRefreshing];
    
    
    // 隐藏时间
    header.stateHidden = YES;
    
    // 隐藏状态
    header.updatedTimeHidden = YES;
    
    
    
}
@end
